<?php
namespace app\api\controller;

use app\api\controller;
use think\Db;


class Feedback extends Base
{   
     
     public function user_feedback(){
        $data = $this->request->param();
        

        if(isset($data['control_board_number']) && isset($data['lock_number'])){
            $feedback_info['lock_id'] = Db::name('lock')->where('control_board_number',$data['control_board_number'])->where('lock_number',$data['lock_number'])->value('id');
        }

        $feedback_info['user_id']          = $this->userId;
        $feedback_info['feedback_type']    = $data['feedback_type'];
        $feedback_info['feedback_content'] = $data['feedback_content'];
        $feedback_info['time']             = time();

        if(Db::name('user_feedback')->insert($feedback_info)){
            $this->success("添加成功!");
        }else{
            $this->error("添加失败!");
        }
       

     }
}